//
//  ZCUnqualifiedCell.m
//  zctx
//
//  Created by apple on 15/11/25.
//  Copyright © 2015年 sanliang. All rights reserved.
//

#import "ZCUnqualifiedCell.h"

@implementation ZCUnqualifiedCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        [self addShiView];
        [self addHarmView];
        
        UITapGestureRecognizer *rescognizer = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(CickView:)];
        [self.shiView addGestureRecognizer:rescognizer];
        
        UITapGestureRecognizer *harmrecognizer = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(CickView:)];
        [self.harmView addGestureRecognizer:harmrecognizer];
    }
    return self;
}

-(void)CickView:(UITapGestureRecognizer *)sender{
    NSInteger index = sender.view.tag;
    if (_delegate  && [ _delegate respondsToSelector:@selector(UnqualifiedCellClick:)]) {
        [_delegate UnqualifiedCellClick:index];
    }
}

-(void)addShiView{
    [self.contentView addSubview:self.shiView];
    [self.shiView makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.contentView.centerY).with.offset(0);
        make.left.equalTo(self.contentView.left).with.offset(12);
        make.top.equalTo(self.contentView.top).with.offset(5);
        make.width.mas_equalTo((SCREEN_WIDTH-29)/2);
    }];
    
    [self addShiTitleLable];
    [self addShicontentLable];
}

-(void)addShiTitleLable{
    [self.shiView addSubview:self.shiTitleLable];
    [self.shiTitleLable makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.shiView.centerY).with.offset(-12);
        make.centerX.equalTo(self.shiView.centerX).with.offset(0);
        make.height.mas_equalTo(25);
        make.width.equalTo(self.shiView.width).with.offset(0);
    }];
}

-(void)addShicontentLable{
    [self.shiView addSubview:self.shicontentLable];
    [self.shicontentLable makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.shiView.centerY).with.offset(12);
        make.centerX.equalTo(self.shiView.centerX).with.offset(0);
        make.height.mas_equalTo(25);
        make.width.equalTo(self.shiView.width).with.offset(0);
    }];
}

-(void)addHarmView{
    [self.contentView addSubview:self.harmView];
    [self.harmView makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.contentView.centerY).with.offset(0);
        make.right.equalTo(self.contentView.right).with.offset(-12);
        make.top.equalTo(self.contentView.top).with.offset(5);
        make.width.mas_equalTo((SCREEN_WIDTH-29)/2);
    }];
    
    [self addHarmTitleLable];
    [self addHarmcontentLable];
}

-(void)addHarmTitleLable{
    [self.harmView addSubview:self.harmTitleLable];
    [self.harmTitleLable makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.harmView.centerY).with.offset(-12);
        make.centerX.equalTo(self.harmView.centerX).with.offset(0);
        make.height.mas_equalTo(25);
        make.width.equalTo(self.harmView.width).with.offset(0);
    }];
}

-(void)addHarmcontentLable{
    [self.harmView addSubview:self.harmcontentLable];
    [self.harmcontentLable makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.harmView.centerY).with.offset(12);
        make.centerX.equalTo(self.harmView.centerX).with.offset(0);
        make.height.mas_equalTo(25);
        make.width.equalTo(self.harmView.width).with.offset(0);
    }];}



-(UIView *)harmView{
    if (!_harmView) {
        _harmView = [[UIView alloc]init];
        _harmView.backgroundColor = [UIColor colorWithHexString:@"#FFCBD9"];
        _harmView.tag = 1;
    }
    return _harmView;
}

-(UIView *)shiView{
    if (!_shiView) {
        _shiView = [[UIView alloc]init];
        _shiView.backgroundColor = [UIColor colorWithHexString:@"#C0E4FD"];
        _shiView.tag = 0;
    }
    return _shiView;
}

-(UILabel *)shiTitleLable{
    if (!_shiTitleLable) {
        _shiTitleLable = [[UILabel alloc]init];
        _shiTitleLable.textColor = [UIColor colorWithHexString:@"#3DAEFF"];
        _shiTitleLable.font = [UIFont boldSystemFontOfSize:16];
        _shiTitleLable.textAlignment = NSTextAlignmentCenter;
        _shiTitleLable.text = @"食事周刊";
    }
    return _shiTitleLable;
}

-(UILabel *)shicontentLable{
    if (!_shicontentLable) {
        _shicontentLable = [[UILabel alloc]init];
        _shicontentLable.textColor = [UIColor colorWithHexString:@"#3DAEFF"];
        _shicontentLable.font = [UIFont systemFontOfSize:13];
        _shicontentLable.textAlignment = NSTextAlignmentCenter;
        _shicontentLable.text = @"吃的安全吃的健康";
    }
    return _shicontentLable;
}

-(UILabel *)harmTitleLable{
    if (!_harmTitleLable) {
        _harmTitleLable = [[UILabel alloc]init];
        _harmTitleLable.textColor = [UIColor colorWithHexString:@"#FE62A3"];
        _harmTitleLable.font = [UIFont boldSystemFontOfSize:16];
        _harmTitleLable.textAlignment = NSTextAlignmentCenter;
        _harmTitleLable.text = @"有害产品曝光";
        
    }
    return _harmTitleLable;
}

-(UILabel *)harmcontentLable{
    if (!_harmcontentLable) {
        _harmcontentLable = [[UILabel alloc]init];
        _harmcontentLable.textColor = [UIColor colorWithHexString:@"#FF62A3"];
        _harmcontentLable.font = [UIFont systemFontOfSize:13];
        _harmcontentLable.textAlignment = NSTextAlignmentCenter;
        _harmcontentLable.text = @"远离危害预防中招";
    }
    return _harmcontentLable;
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
